\(\int \frac {1}{\sqrt {1+\tanh ^2(x)}} \, dx\) [255]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [B] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [F]
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 10, antiderivative size = 25 \[ \int \frac {1}{\sqrt {1+\tanh ^2(x)}} \, dx=\frac {\text {arctanh}\left (\frac {\sqrt {2} \tanh (x)}{\sqrt {1+\tanh ^2(x)}}\right )}{\sqrt {2}} \]

[Out]

1/2*arctanh(2^(1/2)*tanh(x)/(1+tanh(x)^2)^(1/2))*2^(1/2)

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 25, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.300, Rules used = {3742, 385, 212} \[ \int \frac {1}{\sqrt {1+\tanh ^2(x)}} \, dx=\frac {\text {arctanh}\left (\frac {\sqrt {2} \tanh (x)}{\sqrt {\tanh ^2(x)+1}}\right )}{\sqrt {2}} \]

[In]

Int[1/Sqrt[1 + Tanh[x]^2],x]

[Out]

ArcTanh[(Sqrt[2]*Tanh[x])/Sqrt[1 + Tanh[x]^2]]/Sqrt[2]

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 385

Int[((a_) + (b_.)*(x_)^(n_))^(p_)/((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Subst[Int[1/(c - (b*c - a*d)*x^n), x]
, x, x/(a + b*x^n)^(1/n)] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && EqQ[n*p + 1, 0] && IntegerQ[n]

Rule 3742

Int[((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x]
, x]}, Dist[c*(ff/f), Subst[Int[(a + b*(ff*x)^n)^p/(c^2 + ff^2*x^2), x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ
[{a, b, c, e, f, n, p}, x] && (IntegersQ[n, p] || IGtQ[p, 0] || EqQ[n^2, 4] || EqQ[n^2, 16])

Rubi steps \begin{align*} \text {integral}& = \text {Subst}\left (\int \frac {1}{\left (1-x^2\right ) \sqrt {1+x^2}} \, dx,x,\tanh (x)\right ) \\ & = \text {Subst}\left (\int \frac {1}{1-2 x^2} \, dx,x,\frac {\tanh (x)}{\sqrt {1+\tanh ^2(x)}}\right ) \\ & = \frac {\text {arctanh}\left (\frac {\sqrt {2} \tanh (x)}{\sqrt {1+\tanh ^2(x)}}\right )}{\sqrt {2}} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 35, normalized size of antiderivative = 1.40 \[ \int \frac {1}{\sqrt {1+\tanh ^2(x)}} \, dx=\frac {\text {arcsinh}\left (\sqrt {2} \sinh (x)\right ) \sqrt {\cosh (2 x)} \text {sech}(x)}{\sqrt {2} \sqrt {1+\tanh ^2(x)}} \]

[In]

Integrate[1/Sqrt[1 + Tanh[x]^2],x]

[Out]

(ArcSinh[Sqrt[2]*Sinh[x]]*Sqrt[Cosh[2*x]]*Sech[x])/(Sqrt[2]*Sqrt[1 + Tanh[x]^2])

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(61\) vs. \(2(20)=40\).

Time = 0.17 (sec) , antiderivative size = 62, normalized size of antiderivative = 2.48

method result size
derivativedivides \(\frac {\sqrt {2}\, \operatorname {arctanh}\left (\frac {\left (2+2 \tanh \left (x \right )\right ) \sqrt {2}}{4 \sqrt {\left (\tanh \left (x \right )-1\right )^{2}+2 \tanh \left (x \right )}}\right )}{4}-\frac {\sqrt {2}\, \operatorname {arctanh}\left (\frac {\left (2-2 \tanh \left (x \right )\right ) \sqrt {2}}{4 \sqrt {\left (1+\tanh \left (x \right )\right )^{2}-2 \tanh \left (x \right )}}\right )}{4}\) \(62\)
default \(\frac {\sqrt {2}\, \operatorname {arctanh}\left (\frac {\left (2+2 \tanh \left (x \right )\right ) \sqrt {2}}{4 \sqrt {\left (\tanh \left (x \right )-1\right )^{2}+2 \tanh \left (x \right )}}\right )}{4}-\frac {\sqrt {2}\, \operatorname {arctanh}\left (\frac {\left (2-2 \tanh \left (x \right )\right ) \sqrt {2}}{4 \sqrt {\left (1+\tanh \left (x \right )\right )^{2}-2 \tanh \left (x \right )}}\right )}{4}\) \(62\)

[In]

int(1/(1+tanh(x)^2)^(1/2),x,method=_RETURNVERBOSE)

[Out]

1/4*2^(1/2)*arctanh(1/4*(2+2*tanh(x))*2^(1/2)/((tanh(x)-1)^2+2*tanh(x))^(1/2))-1/4*2^(1/2)*arctanh(1/4*(2-2*ta
nh(x))*2^(1/2)/((1+tanh(x))^2-2*tanh(x))^(1/2))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 543 vs. \(2 (20) = 40\).

Time = 0.26 (sec) , antiderivative size = 543, normalized size of antiderivative = 21.72 \[ \int \frac {1}{\sqrt {1+\tanh ^2(x)}} \, dx=\text {Too large to display} \]

[In]

integrate(1/(1+tanh(x)^2)^(1/2),x, algorithm="fricas")

[Out]

1/8*sqrt(2)*log(-2*(cosh(x)^8 + 8*cosh(x)*sinh(x)^7 + sinh(x)^8 + (28*cosh(x)^2 - 3)*sinh(x)^6 - 3*cosh(x)^6 +
 2*(28*cosh(x)^3 - 9*cosh(x))*sinh(x)^5 + 5*(14*cosh(x)^4 - 9*cosh(x)^2 + 1)*sinh(x)^4 + 5*cosh(x)^4 + 4*(14*c
osh(x)^5 - 15*cosh(x)^3 + 5*cosh(x))*sinh(x)^3 + (28*cosh(x)^6 - 45*cosh(x)^4 + 30*cosh(x)^2 - 4)*sinh(x)^2 -
4*cosh(x)^2 + 2*(4*cosh(x)^7 - 9*cosh(x)^5 + 10*cosh(x)^3 - 4*cosh(x))*sinh(x) + (sqrt(2)*cosh(x)^6 + 6*sqrt(2
)*cosh(x)*sinh(x)^5 + sqrt(2)*sinh(x)^6 + 3*(5*sqrt(2)*cosh(x)^2 - sqrt(2))*sinh(x)^4 - 3*sqrt(2)*cosh(x)^4 +
4*(5*sqrt(2)*cosh(x)^3 - 3*sqrt(2)*cosh(x))*sinh(x)^3 + (15*sqrt(2)*cosh(x)^4 - 18*sqrt(2)*cosh(x)^2 + 4*sqrt(
2))*sinh(x)^2 + 4*sqrt(2)*cosh(x)^2 + 2*(3*sqrt(2)*cosh(x)^5 - 6*sqrt(2)*cosh(x)^3 + 4*sqrt(2)*cosh(x))*sinh(x
) - 4*sqrt(2))*sqrt((cosh(x)^2 + sinh(x)^2)/(cosh(x)^2 - 2*cosh(x)*sinh(x) + sinh(x)^2)) + 4)/(cosh(x)^6 + 6*c
osh(x)^5*sinh(x) + 15*cosh(x)^4*sinh(x)^2 + 20*cosh(x)^3*sinh(x)^3 + 15*cosh(x)^2*sinh(x)^4 + 6*cosh(x)*sinh(x
)^5 + sinh(x)^6)) + 1/8*sqrt(2)*log(2*(cosh(x)^4 + 4*cosh(x)*sinh(x)^3 + sinh(x)^4 + (6*cosh(x)^2 + 1)*sinh(x)
^2 + cosh(x)^2 + 2*(2*cosh(x)^3 + cosh(x))*sinh(x) + (sqrt(2)*cosh(x)^2 + 2*sqrt(2)*cosh(x)*sinh(x) + sqrt(2)*
sinh(x)^2 + sqrt(2))*sqrt((cosh(x)^2 + sinh(x)^2)/(cosh(x)^2 - 2*cosh(x)*sinh(x) + sinh(x)^2)) + 1)/(cosh(x)^2
 + 2*cosh(x)*sinh(x) + sinh(x)^2))

Sympy [F]

\[ \int \frac {1}{\sqrt {1+\tanh ^2(x)}} \, dx=\int \frac {1}{\sqrt {\tanh ^{2}{\left (x \right )} + 1}}\, dx \]

[In]

integrate(1/(1+tanh(x)**2)**(1/2),x)

[Out]

Integral(1/sqrt(tanh(x)**2 + 1), x)

Maxima [F]

\[ \int \frac {1}{\sqrt {1+\tanh ^2(x)}} \, dx=\int { \frac {1}{\sqrt {\tanh \left (x\right )^{2} + 1}} \,d x } \]

[In]

integrate(1/(1+tanh(x)^2)^(1/2),x, algorithm="maxima")

[Out]

integrate(1/sqrt(tanh(x)^2 + 1), x)

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 58 vs. \(2 (20) = 40\).

Time = 0.27 (sec) , antiderivative size = 58, normalized size of antiderivative = 2.32 \[ \int \frac {1}{\sqrt {1+\tanh ^2(x)}} \, dx=-\frac {1}{4} \, \sqrt {2} {\left (\log \left (\sqrt {e^{\left (4 \, x\right )} + 1} - e^{\left (2 \, x\right )} + 1\right ) + \log \left (\sqrt {e^{\left (4 \, x\right )} + 1} - e^{\left (2 \, x\right )}\right ) - \log \left (-\sqrt {e^{\left (4 \, x\right )} + 1} + e^{\left (2 \, x\right )} + 1\right )\right )} \]

[In]

integrate(1/(1+tanh(x)^2)^(1/2),x, algorithm="giac")

[Out]

-1/4*sqrt(2)*(log(sqrt(e^(4*x) + 1) - e^(2*x) + 1) + log(sqrt(e^(4*x) + 1) - e^(2*x)) - log(-sqrt(e^(4*x) + 1)
 + e^(2*x) + 1))

Mupad [B] (verification not implemented)

Time = 0.19 (sec) , antiderivative size = 63, normalized size of antiderivative = 2.52 \[ \int \frac {1}{\sqrt {1+\tanh ^2(x)}} \, dx=\frac {\sqrt {2}\,\left (\ln \left (\mathrm {tanh}\left (x\right )+1\right )-\ln \left (\sqrt {2}\,\sqrt {{\mathrm {tanh}\left (x\right )}^2+1}-\mathrm {tanh}\left (x\right )+1\right )\right )}{4}+\frac {\sqrt {2}\,\left (\ln \left (\mathrm {tanh}\left (x\right )+\sqrt {2}\,\sqrt {{\mathrm {tanh}\left (x\right )}^2+1}+1\right )-\ln \left (\mathrm {tanh}\left (x\right )-1\right )\right )}{4} \]

[In]

int(1/(tanh(x)^2 + 1)^(1/2),x)

[Out]

(2^(1/2)*(log(tanh(x) + 1) - log(2^(1/2)*(tanh(x)^2 + 1)^(1/2) - tanh(x) + 1)))/4 + (2^(1/2)*(log(tanh(x) + 2^
(1/2)*(tanh(x)^2 + 1)^(1/2) + 1) - log(tanh(x) - 1)))/4